package com.after.saas.common.constants;

import lombok.Getter;

import java.util.Arrays;

/**
 * @Classname SortEnum
 * @Description TODO
 * @auth after
 * @since 2021/8/14 10:01
 */

@Getter
public enum SortEnum {

    /**
     * 通用枚举
     */
    ASC("ASC", "正序"),
    /**
     * 用户域枚举
     */
    DESC("DESC", "倒序");
    /**
     * 枚举编码
     */
    private final String sort;
    /**
     * 枚举说明
     */
    private final String name;

    /**
     * 构造方法
     */
    SortEnum(String sort, String name) {
        this.sort = sort;
        this.name = name;
    }

    public static SortEnum getEnum(String sort) {
        return Arrays.stream(SortEnum.values()).filter(a -> a.getSort().equalsIgnoreCase(sort)).findAny().get();
    }


}
